home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / ARGO / SUPPORT / NEWSCLEAN.SPK / !NewsClean / !RunImage (.txt) < prev    next >
RISC OS BBC BASIC V Source  |  1996-09-23  |  7KB  |  293 lines

  1.  NewsAgent cleaner tool
  2.  By Rich Goodwin
  3. " at line ";
  4. Task$="News Cleaner"
  5. 'Purpose$="wipe data from NewsAgent"
  6. %Author$=
  7. (169)+" Richard Goodwin"
  8.     $Version$="1.01 (September 1996)"
  9. inputaccept=
  10. openmain
  11. ReadSubs
  12.  numberofgroups$=
  13. (groups) 
  14. AlterIcons("Parity in group numbers - continue?",2) 
  15. AlterIcons("Warning: discrepancy in groups - continue?",2)
  16. inputaccept=
  17.  quit
  18. AlterIcons("Exiting NewsAgent Cleaner...",2)
  19. >T+50:
  20. $(block%)="TASK"
  21. "Wimp_CloseDown",taskhandle,!block%
  22. quit=0
  23. error=0 
  24.  group$(500,6)
  25.  block% 256
  26.  menublock% 256
  27.  "Wimp_Initialise",200,&4B534154,Task$ 
  28.  ,taskhandle
  29.  "Wimp_OpenTemplate",,"NewsClean:Templates"
  30.  "Wimp_LoadTemplate",,,,,,"Info" 
  31.  ,templen,worklen
  32.  info templen,infowork worklen
  33.  "Wimp_LoadTemplate",,info,infowork,infowork+worklen,-1,"Info",0
  34.  "Wimp_LoadTemplate",,,,,,"Main" 
  35.  ,templen,worklen
  36.  main templen,mainwork worklen
  37.  "Wimp_LoadTemplate",,main,mainwork,mainwork+worklen,-1,"Main",0
  38.  "Wimp_LoadTemplate",,,,,,"Characters" 
  39.  ,templen,worklen
  40.  "Wimp_CloseTemplate"
  41.  "Wimp_CreateWindow",,info 
  42.  infohandle
  43.  "Wimp_CreateWindow",,main 
  44.  mainhandle
  45. version
  46. iconbar
  47. iconbar
  48. !block%=-1
  49. block%!4=0
  50. block%!8=0
  51. block%!12=68
  52. block%!16=68
  53. block%!20=&201A
  54. $(block%+24)="!newsclean"
  55.  "Wimp_CreateIcon",,block% 
  56.  iconbarhandle
  57. version
  58. !block%=infohandle
  59. block%!4=1
  60. "Wimp_GetIconState",,block%
  61. $(block%!28)=Task$ 
  62. !block%=infohandle
  63. block%!4=2
  64. "Wimp_GetIconState",,block%
  65. $(block%!28)=Purpose$  
  66. !block%=infohandle
  67. block%!4=3
  68. "Wimp_GetIconState",,block%
  69. $(block%!28)=Author$
  70. !block%=infohandle
  71. block%!4=4
  72. "Wimp_GetIconState",,block%
  73. $(block%!28)=Version$
  74. makeiconmenu(X)
  75. $(menublock%)=Task$
  76. menublock%!12=&00070207
  77. menublock%!16=182
  78. menublock%!20=44
  79. menublock%!24=0
  80. menublock%!28=2
  81. menublock%!32=infohandle
  82. menublock%!36=&7000001
  83. $(menublock%+40)="Info"
  84. menublock%!52=&80
  85. menublock%!56=-1
  86. menublock%!60=&7000001
  87. $(menublock%+64)="Quit"
  88. "Wimp_CreateMenu",,menublock%,X,200
  89. openmain
  90. !block%=mainhandle
  91. "Wimp_GetWindowState",,block%
  92. block%!28=-1
  93. "Wimp_OpenWindow",,block%
  94. "Wimp_Poll",0,block% 
  95.  reason,handle
  96.  reason 
  97.  1 : 
  98. "Wimp_RedrawWindow",,block%
  99.  2 : 
  100. "Wimp_OpenWindow",,block%
  101.  3 : 
  102. "Wimp_CloseWindow",,block%
  103.  6 : 
  104. mouseclick(block%)
  105.  9 : 
  106. menuselect(block%)
  107.  17,18 :
  108. message(block%)
  109. mouseclick(bl)
  110.  bl!12=-2 
  111. oniconbar
  112.  bl!12=mainhandle 
  113. ClickOnMain
  114. oniconbar
  115.  bl!8=2 
  116.  bl!16=iconbarhandle 
  117. makeiconmenu(!bl-64)
  118.  bl!8=1 
  119.  bl!16=iconbarhandle 
  120. openmain
  121. message(bl)
  122.  bl!16 
  123.  0 : quit=-1
  124.  &502: 
  125. menuselect(bl)
  126.  !bl 
  127.  1: quit=-1
  128. zero(number%)
  129.  number%<=9 
  130.  number%>=0 
  131.  ="0" 
  132. ClickOnMain
  133.  temp$, icon%
  134.  inputaccept=
  135. icon%=bl!16
  136.  IF icon%>=0 AND icon%<=11 THEN temp$=ircmacro$(icon%+1)
  137.  icon%=4 quit=
  138.  icon%=3 
  139.  inputaccept=
  140.  inputaccept=
  141. :icon%=0:
  142. operate
  143.  icon%=3 
  144.  inputaccept=2    
  145.  inputaccept=
  146. operate2:quit=
  147.  help$
  148.  block%!32 
  149.  -2:help$="This is the "+Task$+" icon.|MIt allows "+Purpose$+".|M"
  150.  infohandle:help$=Task$+": Version "+Version$+"|M"+Author$+"|M"
  151.  help$<>"" 
  152. block%!12=block%!8
  153. block%!16=&503
  154. $(block%+20)=help$+
  155. !block%=(25+
  156.  help$) 
  157.  "Wimp_SendMessage",17,block%,block%!4,0
  158. GetFileType
  159.  "OS_File",5,name$ 
  160.  ,,filetype%
  161. &filetype%=(filetype% 
  162.  &FFF00)>>>8
  163. GetFileInfo
  164.  pos%,q$,noextension$
  165. pos%=
  166. (name$):file$=""
  167. name$,pos%,1)
  168. pos%-=1
  169.  q$<>"." 
  170.  file$=q$+file$
  171.  q$="."
  172. noextension$="":pos%=0
  173. pos%+=1
  174. file$,pos%,1)
  175.  q$<>"/" noextension$+=q$
  176.  q$="/" 
  177.  pos%>=
  178. (file$)
  179. file$=noextension$
  180. RedrawWindows
  181. "Wimp_ForceRedraw",-1,-1000,-1000,6000,6000
  182. ReadSubs
  183. >inputfile$="<VTiInternet$Dir>.Apps.News.!NewsAgent.Groups"
  184. "OS_File",5,inputfile$ 
  185.  check%
  186.  check%=0 quit=
  187. "Copy "+inputfile$+" NewsClean:Backup ~A ~C ~D F ~N ~P Q ~R S ~T ~V"
  188. fileopen=
  189.  inputfile$
  190. #fileopen:
  191. " at line ";
  192. newsversion$=""
  193. char=
  194. #fileopen
  195.  char<>10 
  196.  newsversion$=newsversion$+
  197. (char)
  198.  char=10
  199. numberofgroups$=""
  200. char=
  201. #fileopen
  202.  char<>10 
  203.  numberofgroups$=numberofgroups$+
  204. (char)
  205.  char=10
  206. groups=0
  207.  fullgroup$=""
  208.   char=
  209. #fileopen
  210.   char$=
  211. (char)
  212.  char<>10 
  213.  fullgroup$=fullgroup$+char$
  214.  char=10
  215.  fullgroup$<>"" 
  216.  groups+=1:
  217. AddAGroup(fullgroup$)
  218. #fileopen
  219. #fileopen
  220. " at line ";
  221. AddAGroup(fullgroup$)
  222. group$(groups,1)=""
  223. counter=0
  224.  loop=1
  225.   counter+=1
  226. "  char$=
  227. fullgroup$,counter,1)
  228. (char$)<>32 
  229.  group$(groups,loop)=group$(groups,loop)+char$
  230. (char$)=32
  231.  counter+=1
  232. % letter=
  233. fullgroup$,counter,1))
  234.  letter<>10 
  235.  group$(groups,6)=group$(groups,6)+
  236. (letter)
  237.  counter=
  238. (fullgroup$)
  239. AlterIcons(numberofgroups$,5)
  240. AlterIcons(
  241. (groups),1)
  242. AlterIcons(text$,iconnumber)
  243. !block%=mainhandle
  244. block%!4=iconnumber
  245. "Wimp_GetIconState",,block%
  246. $(block%!28)=text$
  247. block%!8=0:block%!12=0
  248. "Wimp_SetIconState",,block%
  249. operate
  250. AlterIcons("Wiping articles",2)
  251. "XOS_CLI","WIPE <VTiInternet$Dir>.Apps.News.!NewsAgent.Articles ~C F R ~V"
  252. "XOS_CLI","CDIR <VTiInternet$Dir>.Apps.News.!NewsAgent.Articles"
  253. AlterIcons("Wiping groups info",2)
  254. "XOS_CLI","COPY <VTiInternet$Dir>.Apps.News.!NewsAgent.Group.Index NewsClean:Index ~A ~C ~D F ~N ~P Q ~R S ~T ~V"
  255. "XOS_CLI","WIPE <VTiInternet$Dir>.Apps.News.!NewsAgent.Group ~C F R ~V"
  256. "XOS_CLI","CDIR <VTiInternet$Dir>.Apps.News.!NewsAgent.Group"
  257. "XOS_CLI","CDIR <VTiInternet$Dir>.Apps.News.!NewsAgent.Group.0"
  258. "XOS_CLI","COPY NewsClean:Index <VTiInternet$Dir>.Apps.News.!NewsAgent.Group.Index ~A ~C ~D F ~N ~P Q ~R S ~T ~V"
  259. "XOS_CLI","WIPE NewsClean:Index ~C F R ~V"
  260. AlterIcons("Recreating subscription file",2)
  261.  groups=0 
  262. =fileout=
  263.  "<VTiInternet$Dir>.Apps.News.!NewsAgent.Groups"
  264. tofile(newsversion$+
  265. (10))
  266. tofile(
  267. (groups)+
  268. (10))
  269.  loop=1 
  270.  groups
  271. tofile("0 ")
  272. tofile(group$(loop,2)+" ")
  273. tofile("0 ")
  274. tofile(group$(loop,4)+" ")
  275. tofile(group$(loop,5)+" ")
  276. tofile(group$(loop,6)+
  277. (10))
  278. #fileout
  279. inputaccept=2
  280. AlterIcons("Wipe unprocessed news?",2)
  281. operate2
  282. "XOS_CLI","WIPE <VTiInternet$Dir>.Apps.News.News ~C F R ~V"
  283. "XOS_CLI","WIPE <VTiInternet$Dir>.Apps.News.!NewsAgent.NewsCopy ~C F R ~V"
  284. "XOS_CLI","WIPE <VTiInternet$Dir>.Apps.News.!NewsAgent.OffCopy ~C F R ~V"
  285. tofile(tofile$)
  286.  output
  287.  tofile$="" 
  288.  pos%=1
  289. (tofile$)
  290. output=
  291. tofile$,pos%,1)
  292. #fileopen,output
  293.